<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      (function () {
        // html font-size
        const htmlEl = document.documentElement;
        // 屏幕宽度
        htmlEl.style.fontSize = window.innerWidth / 10 + 'px';
        window.addEventListener('resize', () => {
          htmlEl.style.fontSize = window.innerWidth / 10 + 'px';
        });
      })();
      // window.onresize = function () {
      //   update();
      // };
    </script>
    <style>
      * {
        margin: 0;
        padding: 0;
      }

      .col {
        width: 5rem;
        height: 100px;
        line-height: 100px;
        background-color: green;
        color: white;
        font-size: 50px;
      }
    </style>
  </head>
  <body>
    <div class="col">123</div>
  </body>
</html>
